package NovelBar.mapper;

import NovelBar.entity.Role;
import NovelBar.entity.User;
import NovelBar.entity.Witer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface UserMapper {
    public User loadUserByUsername(String username);

    List<Role> getUserRolesByUid(Integer id);

    void addUser(User user);

    void setUserRole(@Param("uid") Integer uid,@Param("rid") Integer rid);

    void updateUsernameByUsername(@Param("oldUsername") String oldUsername,@Param("newUsername") String newUsername);

    void addWiter(Witer witer);

    Witer loadWiterById(Integer uid);
    User loadUserById(Integer id);
    void setUserMoney(@Param("id") Integer id, @Param("money") Integer money);

    String loadUsernameById(Integer userId);

    void banWiter(Integer userid);

    Witer loadWiterBywId(Integer id);
    List<User> banUserList();
    void removeBan(Integer id);
    void charge(@Param("id") Integer id, @Param("money") Integer money);
}
